<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<title>发现好货</title>
	<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/mui/js/mui.min.js"></script>
	<link href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/mui/css/mui.min.css" rel="stylesheet" />
	<link href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/css/other/all.css" rel="stylesheet" />
	<link href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/css/other/app.css" rel="stylesheet" />
	<link href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/css/app.css" rel="stylesheet" />
	<link href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/swiper/css/swiper.min.css" rel="stylesheet" />
	<link href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/font/iconfont.css" rel="stylesheet" />
	<link href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/css/dropload.css" rel="stylesheet" />
</head>
<style type="text/css">
	body{
		background: #fff;
	}
	.hotselling .list-price{font-size: 18px}
	.list-price em{font-size: 12px;}
	.PrdLineStyle .goto{position: relative;}
	.PrdLineStyle .goto .scadd{color:#e54242;position:absolute;bottom: 8px;right:13px;font-size: 18pt}
	.PrdLineStyle .goto .x{position:absolute;top: 0px;right:0px;width: 30px;height: 30px;}
	.right li{position: relative;}
	.right li .x{position: absolute;right: 0;top: 0;width: 30px;height: 30px;}
	.PrdLineStyle dd{width: calc(100% - 30vw - 10px);float: right;}
</style>
<body>
<div class="viewports goods">
	<div class="header">
		<h1>为您挑选精品好物<span class="fr"><i class="mui-icon iconfont">&#xe786;</i></span></h1>
	</div>
	<div id="taobao-best">
		<div class="swiper-container show-swiper">
		    <div class="swiper-wrapper">
		    {{range .ad}}
		      <div class="swiper-slide">
		          <div class="goods">
		             <a href="{{.url}}">
		                 <img style="width: 100%;height: auto;" src="{{.pathname}}">
		              </a>   
		          </div>
		      </div>
		     {{end}}
		      <div class="swiper-slide last-slide">
		      <span class="icon"></span>
		      <!-- <p class="text">更多</p> -->
		      </div>
		    </div>
		</div>
		<div class="mask"></div>
  		<div class="swiper-container bg-swiper swiper-no-swiping"></div>
	</div>
</div>
<div class="fgoods list">
	<div class="left">
		<h1>HOT<span class="ml-5">！</span></h1>
		<p class="mt-5">这些好物<br>你会喜欢</p>
	</div>
	<div class="right">
		<div class="column">
			<ul>
				{{range .rinfo}}
				<li>
					<a href="/mobile/column/product_content?id={{.id}}">
						<img src="{{.pathname}}">
						<div class="overpl1 fs-12 title tx-c">{{.title}}</div>
					</a>
					{{if eq .active 1}}
					<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/gbuy.png" class="x">
					{{else if eq .active 2}}
					<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/sales.png" class="x">
					{{end}}
				</li>
				{{end}}
			</ul>
		</div>
	</div>
</div>
<div class="PrdLineStyle">
		{{range .info}}
		<dl class="goto">
			<dt class="goto" href="/mobile/column/product_content?id={{.id}}"><img src="{{.pathname}}" alt=""></dt>
			<dd>
				<p>{{.title}}</p>
				<p>{{range .keywords}}<span>{{.}}</span>{{end}}
				<p><span><span>&yen;</span>{{if .vprice}}{{.vprice}}{{else}}{{.price}}{{end}}</span>{{.sellnum}}人购买</p>
				<p>{{if .gname}}{{.gname}} {{else}}{{$.system.name}} {{end}}<a href="/mobile/index/shop?id={{.gid}}">进店<i class="iconfont">&#xe7bb;</i></a></p>
			</dd>
			<i class="iconfont scadd" data-id="{{.id}}" >&#xe619;</i>
			{{if eq .active 1}}
			<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/gbuy.png" class="x">
			{{else if eq .active 2}}
			<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/sales.png" class="x">
			{{end}}
		</dl>
		{{end}}
	</div>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/swiper/js/swiper.min.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/js/zepto.min.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/js/dropload.min.js"></script>
{{template "wechat/public/share.html" .}}
<script></script> 
<script type="text/javascript">
function stopPropagation(e) {  
    if (e.stopPropagation) {  
        e.stopPropagation();  
    } else {  
        e.cancelBubble = true;  
    }  
}  
mui('body').on('click','.scadd',function(e){
	stopPropagation(e)
	var pid=this.getAttribute("data-id")
	var data={num:1,pid:pid}
	mui.post('/mobile/shopcar',data,function(res){
		if(res==2||res==962){
			mui.confirm("您还未登入,请先登入","提示",function(res){
				if(res.index){
					mui.closePopups()
					window.location.href="/mobile/login"
				}
			})
		}else if(res==1){
			mui.toast("添加成功~")
		}else if(res==0){
			mui.toast("网络繁忙,请重试!")
		}else if(res==3){
          mui.toast('库存不足');
        }
	})
})
	mui('body').on('tap','.goto',function(){
		var h=this.getAttribute("href")
		if(h){window.location.href=h }
	})
	mui('body').on('tap','a',function(){
		var h=this.getAttribute("href")
		if(h){window.location.href=h }
	})
var swiperBg = new Swiper(".bg-swiper", {
    effect: "fade",
    fadeEffect: {
        crossFade: !1
    }
}),
swiperShow = new Swiper(".show-swiper", {
    slidesPerView: "auto",
    watchSlidesProgress: !0,
    slidesOffsetBefore: 15,
    spaceBetween: 17,
    resistanceRatio: 1,
    controller: {
        control: swiperBg
    },
    on: {
        progress: function(b) {
            for (i = 0; i < this.slides.length; i++) slide = this.slides.eq(i),
            slideProgress = this.slides[i].progress,
            prevIndent = 4 == i ? .3228 : .0898,
            scale = 1 > Math.abs(slideProgress + prevIndent) ? .1 * (1 - Math.abs(slideProgress + prevIndent)) + 1 : 1,
            slide.find(".goods").transform("scale3d(" + scale + "," + scale + ",1)")
        },
        setTransition: function(b) {
            for (var a = 0; a < this.slides.length; a++) this.slides.eq(a).find(".goods").transition(b)
        },
        touchMove: function() {
            this.controller.control = .01 > this.progress ? "": swiperBg
        },
        touchEnd: function() { 
        	console.log(this.translate);
        	- 807 > this.translate && alert("15414")
        }
    }
});
var page=2
$('.element').dropload({
    scrollArea : window,
    threshold: 2,
    loadDownFn : function(me){
        $.ajax({
            type: 'GET',
            url: window.location.href,
            dataType: 'json',
            data:{page:page},
            success: function(data){
            	var res=data.info
               page+=1
              if(res){
                 for (var i=0;i<res.length;i++){
                    var dl = document.createElement('dl');
                    dl.className="goto"	
 					var	html=`<dt class="goto" href="/mobile/column/product_content?id=`+res[i].id+`"><img src="`+res[i].pathname+`" alt=""></dt>
					<dd>
						<p>`+res[i].title+`</p><p>`
						if (res[i].keywords){
							for(var j=0;j<res[i].keywords.length;j++){
								html+=`<span>`+res[i].keywords[j]+`</span>`
							}
						}
						html+=`</p><p><span><span>&yen;</span>`
							if(res[i].vprice){
								html+=res[i].vprice
							}else{
								html+=res[i].price
							}
							html+=`</span>`+res[i].sellnum+`人购买</p>`
						if(res[i].gname){
							html+=res[i].gname+` `
						}else{
							html+=`{{.system.name}} `
						}
						html+=`<a href="/mobile/store?id=`+res[i].gid+`">进店<i class="iconfont">&#xe7bb;</i></a></p>
					</dd><i class="iconfont scadd" data-id="`+res[i].id+'" >&#xe619;</i>'
					if (res[i].active==1){
						html+='<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/gbuy.png" class="x">'
					}else if(res[i].active==2){
						html+='<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/sales.png" class="x">'
					}
                    dl.innerHTML=html
                    document.getElementsByClassName('PrdLineStyle')[0].appendChild(dl)
                }
                me.resetload();
                }else{
                    mui.toast("没有更多了！");
                    $(".dropload-down").remove();
                }
            },
            error: function(xhr, type){
                mui.toast("网络慢，请重新刷新!");
                me.resetload();
            }
        });
    }
});
</script>
</body>
</html>